﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using YasharEl.Infrastructure.EntityModel;
using YasharEl.Infrastructure.EntityModel.Specifications;

namespace YasharEl.Infrastructure.ProcessEngine.PersistenceModel.Specifications
{
    [ContractClass(typeof(ProcessDefinitionSpecificationContract))]
    public interface IProcessDefinitionSpecification : ISpecification<IProcessDefinition, long>
    {
        IProcessDefinitionSpecification BelongsToApplication(long applicationId);
    }

    [ContractClassFor(typeof(IProcessDefinitionSpecification))]
    internal abstract class ProcessDefinitionSpecificationContract : IProcessDefinitionSpecification
    {
        #region IProcessDefinitionSpecification Members

        public IProcessDefinitionSpecification BelongsToApplication(long applicationId)
        {
            Contract.Requires<ArgumentNullException>(applicationId > 0, "applicationId must be valid positive numeric value.");

            return this;
        }

        #endregion

        #region ISpecification<IProcessDefinition,long> Members

        public void Initialize(IUnitOfWork unitOfWork)
        {
            Contract.Requires<ArgumentNullException>(unitOfWork != null, "unitOfWork could not be null.");
        }

        public ISpecificationResult<IProcessDefinition, long> ToResult()
        {
            return default(ISpecificationResult<IProcessDefinition, long>);
        }

        public ISpecification<IProcessDefinition, long> Where(Expression<Func<IProcessDefinition, bool>> expression)
        {
            Contract.Requires<ArgumentNullException>(expression != null, "expression could not be null.");

            return default(ISpecification<IProcessDefinition, long>);
        }

        #endregion
    }
}
